import 'dart:convert' show json;

class RespHour {

  String displaydate;
  String hasnexthour;
  String lasthourdate;
  String lasthourhour;
  String nexthourdate;
  String nexthourhour;
  String rankdate;
  String rankduring;
  String rankhour;
  String status;
  List<HourData> data;

  RespHour.fromParams({this.displaydate, this.hasnexthour, this.lasthourdate, this.lasthourhour, this.nexthourdate, this.nexthourhour, this.rankdate, this.rankduring, this.rankhour, this.status, this.data});

  factory RespHour(jsonStr) => jsonStr == null ? null : jsonStr is String ? new RespHour.fromJson(json.decode(jsonStr)) : new RespHour.fromJson(jsonStr);

  RespHour.fromJson(jsonRes) {
    displaydate = jsonRes['displaydate'];
    hasnexthour = jsonRes['hasnexthour'];
    lasthourdate = jsonRes['lasthourdate'];
    lasthourhour = jsonRes['lasthourhour'];
    nexthourdate = jsonRes['nexthourdate'];
    nexthourhour = jsonRes['nexthourhour'];
    rankdate = jsonRes['rankdate'];
    rankduring = jsonRes['rankduring'];
    rankhour = jsonRes['rankhour'];
    status = jsonRes['status'];
    data = jsonRes['data'] == null ? null : [];

    for (var dataItem in data == null ? [] : jsonRes['data']){
      data.add(dataItem == null ? null : new HourData.fromJson(dataItem));
    }
  }

  @override
  String toString() {
    return '{"displaydate": ${displaydate != null?'${json.encode(displaydate)}':'null'},"hasnexthour": ${hasnexthour != null?'${json.encode(hasnexthour)}':'null'},"lasthourdate": ${lasthourdate != null?'${json.encode(lasthourdate)}':'null'},"lasthourhour": ${lasthourhour != null?'${json.encode(lasthourhour)}':'null'},"nexthourdate": ${nexthourdate != null?'${json.encode(nexthourdate)}':'null'},"nexthourhour": ${nexthourhour != null?'${json.encode(nexthourhour)}':'null'},"rankdate": ${rankdate != null?'${json.encode(rankdate)}':'null'},"rankduring": ${rankduring != null?'${json.encode(rankduring)}':'null'},"rankhour": ${rankhour != null?'${json.encode(rankhour)}':'null'},"status": ${status != null?'${json.encode(status)}':'null'},"data": $data}';
  }
}

class HourData {

  int dealfeature;
  int id;
  int iftobuy;
  int imgh;
  int imgw;
  int rank;
  String buyurl;
  String fromsite;
  String image;
  String mall;
  String pubtime;
  String title;

  HourData.fromParams({this.dealfeature, this.id, this.iftobuy, this.imgh, this.imgw, this.rank, this.buyurl, this.fromsite, this.image, this.mall, this.pubtime, this.title});

  HourData.fromJson(jsonRes) {
    dealfeature = jsonRes['dealfeature'];
    id = jsonRes['id'];
    iftobuy = jsonRes['iftobuy'];
    imgh = jsonRes['imgh'];
    imgw = jsonRes['imgw'];
    rank = jsonRes['rank'];
    buyurl = jsonRes['buyurl'];
    fromsite = jsonRes['fromsite'];
    image = jsonRes['image'];
    mall = jsonRes['mall'];
    pubtime = jsonRes['pubtime'];
    title = jsonRes['title'];
  }

  @override
  String toString() {
    return '{"dealfeature": $dealfeature,"id": $id,"iftobuy": $iftobuy,"imgh": $imgh,"imgw": $imgw,"rank": $rank,"buyurl": ${buyurl != null?'${json.encode(buyurl)}':'null'},"fromsite": ${fromsite != null?'${json.encode(fromsite)}':'null'},"image": ${image != null?'${json.encode(image)}':'null'},"mall": ${mall != null?'${json.encode(mall)}':'null'},"pubtime": ${pubtime != null?'${json.encode(pubtime)}':'null'},"title": ${title != null?'${json.encode(title)}':'null'}}';
  }
}

